<#include "../common/layout.ftl"/>
<@layout>
<div width="100%" style="height: 900px;">
	<div class="dxfsqd_title">员工列表</div>
	<div class="dxfsqd_shearch">

	<form method="post" action="/driver" class="form-inline">
			<label><span>工号：</span><input type="text" class="input-medium" style="height: 30px" name="job_number" value="${jobNumber?if_exists}"/></label> 
			<label><span>姓名：</span><input type="text" class="input-medium" style="height: 30px"  name="real_name" value="${name?if_exists}"/></label> 	
			<label><span>手机号：</span><input type="text" class="input-medium" style="height: 30px"  name="cell_phone" value="${phone?if_exists}"/></label> 		
			<label><span>状态：</span>
              <select id="status" name="status"  >
                <option value="" >所有</option>
                <option value="0" <#if status?if_exists?string=='0'>selected</#if>>空闲</option>
                <option value="1" <#if status?if_exists?string=='1'>selected</#if>>待客</option>
                <option value="2" <#if status?if_exists?string=='2'>selected</#if>>代驾中</option>
                <option value="3" <#if status?if_exists?string=='3'>selected</#if>>休息</option>
                <option value="4" <#if status?if_exists?string=='4'>selected</#if>>备用</option>
                <option value="5" <#if status?if_exists?string=='5'>selected</#if>>离职</option>
              </select></label>
             <label><span>余额小于200元：</span><input type="checkbox" class="input-medium" style="width: 40px;" name="balance" value="1" <#if balance??>checked="checked"</#if>/></label>
             <label><span> 同城员工：</span> <input type="checkbox" class="input-medium" style="width: 40px;" name="sameCompany" value="1" <#if sameCompany??>checked="checked"</#if>/></label>
            <label><span> 本人录入：</span><input type="checkbox" class="input-medium" style="width: 40px;"  name="createBySelf" value="1" <#if createBySelf??>checked="checked"</#if>/></label>
		<button type="submit" class="btn"><i class="icon-search icon-white"></i>查询</button>
		<#if session.userRole == 'admin' || session.userRole == 'brandManager' || session.userRole == 'middleManager' || session.userRole == 'customerCenter'>
			<button class="btn btn-success" href="/driver/add"><i class="icon-user icon-white"></i>添加员工</button>
		</#if>
		<button type="button" class="btn btn-info" onclick="javascript:history.back();">返回</button>
		<#if session.userRole == 'admin' || session.userRole == 'brandManager'>
			<label><span>导出</span><a class="dc_exc"  href="/driver/exportXls?job_number=${jobNumber!''}&real_name=${realName!''}&cell_phone=${cellPhone!''}">导出Excel文件</a></label>
		</#if>
		
	</form>
  </div>

<div class="dxfsqd_table">

	<table class="table table-bordered table-striped" >
		<thead>
		  <tr>
			<th  scope="col">工作状态</th>
			<th scope="col">冻结状态</th>
			<th scope="col">工号</th>
			<th scope="col">真实姓名</th>
			<th scope="col">手机号码</th>
			<th scope="col">所属公司</th>			
			<th scope="col">性别</th>
			<th scope="col">驾照</th>
			<th scope="col">籍贯</th>
			<!--th>银行卡号</th-->
			<th scope="col">账户余额</th>
			<th scope="col">总收入</th>
			<th scope="col">佣金类型</th>
			<th scope="col">佣金抽取</th>
			<th scope="col">订单总数量</th>
			<th scope="col">订单总金额</th>
			<th scope="col">已完成订单</th>
			<th scope="col">已撤消订单</th>
			<th scope="col">冻结/解冻原因</th>
			<th scope="col">冻结/解冻时间</th>
			<th scope="col">操作</th>
		  </tr>
		</thead>
		<tbody>
		<#list page.list as driver>
		  <tr>
			<td>
			  <#if driver.status == 0>
			  	<span class="badge badge-success">空闲</span>
			  <#elseif driver.status == 1>
			  	<span class="label label-warning">待客</span>
			  <#elseif driver.status == 2>
			  	<span class="label label-important">代驾中</span>
			  <#elseif driver.status == 3>
			  	<span class="label label-info">休息</span>
			  <#elseif driver.status == 4>balance
			  <#elseif driver.status == 5>
			  	<span class="label label-inverse">离职</span>
			  <#else>
			  	<span class="label">其他</span>
			  </#if>
			</td>
			<td>
			<#if driver.canuse == 0>
			  	<span class="label label-inverse">已冻结</span>
			  <#else>
			  	<span class="label label-success">正常</span>
			  </#if>
			</td>
			<td>
			 ${driver.job_number!""}
			</td>
			<td>
			  ${driver.name!""}
			</td>
			<td>
			  ${driver.phone!""}
			</td>
			<td>
			 	${driver.companyname!""}
			</td>			
			<td>
			  <#if driver.sex == 0>
			  	<span class="label label-info">男</span>
			  <#elseif driver.sex == 1>
			  	<span class="label label-warning">女</span>
			  <#else>
			  	<span class="label label-inverse">未知</span>
			  </#if>
			</td>
			<td>
			  ${driver.driver_license!""}
			</td>
			<td>
				${driver.hometown!""}
			</td>
			
			<!--td>
			    ${driver.bank_no!""}
			</td-->
			
			<td>
				<#if driver.balance??>
					￥${driver.balance?string(",##0.00#")}
				<#else>
					0.0
				</#if>
			</td>
			<td>
				<#if driver.income??>
					￥${driver.income?string(",##0.00#")}
				<#else>
					0.0
				</#if>
			</td>
			<#if driver.commissiontype??>
				<#if driver.commissiontype == 1>
					<td>
					  固定提成
					</td>
					<td>
					  ${driver.fixedmoney!"0"}元
					</td>
				</#if>
				<#if driver.commissiontype == 2>
					<td>
					  比例提成
					</td>
					<td>
					  ${driver.comproportion!"0"}%
					</td>
				</#if>
				<#if driver.commissiontype == 3>
					<td>
					  按天提成
					</td>
					<td>
					    每天
					</td>
				</#if>
			<#else>
				<td>
				    无
				</td>
				<td>
				     无
				</td>
			</#if>
			<td>
			  ${driver.order_count!"0"}
			</td>
			<td>
			  ${driver.sum_money!"0"}
			</td>
			<td>
			  ${driver.finishNum!"0"}
			</td>
			<td>
			  ${driver.cancelNum!"0"}
			</td>
			<td>
			  ${driver.operate_reason!" "}
			</td>
			<td>
			  <#if driver.operate_time??> 
			    ${driver.operate_time?string("yyyy-MM-dd HH:mm:ss")}
			  </#if>
			</td>
			<td nowrap>
					<#if session.userRole == 'admin' || session.userRole == 'brandManager' || session.userRole == 'middleManager' || session.userRole == 'customerCenter'>
			         	<a class="cf" href="/driver/toEditStatus/${driver.id}" ><i class="icon-eye-open icon-white"></i>修改状态</a>
			         </#if>
			         <#if session.userRole == 'admin' || session.userRole == 'brandManager' || session.userRole == 'middleManager' || session.userRole == 'customerCenter'>
					 	<a class="cf" href="/driver/detail/${driver.id}" target="_blank"><i class="icon-eye-open icon-white"></i> 详 情</a>
					 </#if>
					 <#if session.userRole == 'admin' || session.userRole == 'brandManager' || session.userRole == 'middleManager' || session.userRole == 'customerCenter'>
					 	<a class="cf" href="/driver/edit/${driver.id}"><i class="icon-info-sign icon-white"></i> 修 改</a>
					 </#if>
					 <#if session.userRole == 'admin' || session.userRole == 'brandManager' || session.userRole == 'middleManager' || session.userRole == 'customerCenter'>
					 	<a class="cf" href="/driver/frozen/${driver.id}"><i class="icon-lock icon-white"></i> 冻 结</a>
					 </#if>
					 <#if session.userRole == 'admin' || session.userRole == 'seniorManager' || session.userRole == 'brandManager' || session.userRole == 'middleManager'>
					 	<a class="cf" href="/driver/thaw/${driver.id}"><i class="icon-fire icon-white"></i> 解 冻</a>
					 </#if>
					 <#if session.userRole == 'admin'>
					 	<a class="cf" href="javascript:void(0)" onclick="deleteDriver(this, ${driver.id})"><i class="icon-fire icon-white"></i> 删除</a>
					 </#if>
					  <#if session.userRole == 'admin' || session.userRole == 'brandManager' || session.userRole == 'middleManager' || session.userRole == 'customerCenter'>
					 	<a class="cf" href="/driver/drivercanpost/${driver.id}"><i class="icon-plane icon-white"></i> 已选接单类型</a>
					 </#if>
					 <br/>
					 <!--<a class="btn btn-success" href="/driver/delete/${driver.id}"><i class="icon-leaf icon-white"></i> 派 单</a>-->
					 <#if session.userRole == 'admin' || session.userRole == 'brandManager'>
					 	<a class="cf" href="/recharge/add/${driver.id}"><i class="icon-shopping-cart icon-white"></i> 充 值</a>
					 </#if>
					 <#if session.userRole == 'admin' || session.userRole == 'brandManager'>
					 	<a class="cf" href="/recharge/edit/${driver.id}"><i class="icon-shopping-cart icon-white"></i>修改余额</a>
					 </#if>
					 <#if session.userRole == 'admin' || session.userRole == 'brandManager' || session.userRole == 'middleManager' || session.userRole == 'customerCenter'>
					 	<a class="cf" href="/driver/map/${driver.id}" target="_blank"><i class="icon-map-marker icon-white"></i> 地 图</a>
					 </#if>
					 <#if session.userRole == 'admin' || session.userRole == 'brandManager' || session.userRole == 'middleManager' || session.userRole == 'customerCenter'>
					 	<a class="cf" href="/driver/job/${driver.id}"><i class="icon-plane icon-white"></i> 任 务</a>
					 </#if>
					 <#if session.userRole == 'admin' || session.userRole == 'brandManager' || session.userRole == 'middleManager' || session.userRole == 'customerCenter'>
					 	<a class="cf" href="/recharge/driverChargeDetail?driverId=${driver.id}"><i class="icon-plane icon-white"></i> 历史消费记录</a>
					 </#if>
			</td>
		  </tr>
		</#list>
		</tbody>
	</table>
	<#include "../common/paginate.ftl" />
	<@paginate currentPage=page.pageNumber totalPage=page.totalPage actionUrl="/driver/" urlParas="?balance=${balance!''}&sameCompany=${sameCompany!''}&createBySelf=${createBySelf!''}"/>
</div>
</div>

<script type="text/javascript">
	function deleteDriver(obj, id){
		$.ajax({ 
	  		  type: "POST",
	  		  url: "/driver/delete/"+id,
	  		  data: "",
	  		  dataType: "html", 
	  		  async: false,
	  		  success:function(data){
	  		      if(data == '1'){
	  		      	$(obj).parent().parent().hide();
	  		      	alert("删除成功");
	  		      }
	  		  },
			  error:function(data){
			  }
  		});
	}
</script>
</@layout>